<!DOCTYPE html>
<html lang="zh_cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Thymeleaf</title>
</head>
<body>
<h2>th:text</h2>
<div class="api">
    th:text；改变当前元素里面的文本内容；
</div>
<div th:text="${msg}">span默认文本内容</div>
<div>
    点位符：<th:block th:text="${msg}" />11111111点位符
</div>
id: <span th:text="${blog.id}">xx</span>
name: <span th:text="${blog.name}">xxx</span>
pwd: <span th:text="${blog.pwd}">xxx</span>
<h2>th:utext</h2>
<div class="api">
    th:utext ：这个会转义html
</div>
<div th:utext="${html}"></div>
<div th:text="${html}"></div>

<h2>th:value</h2>
<input th:value="${thValue}">

<h2>th:src</h2>
<img th:src="${thSrc}"/>

<h2>th:href</h2>
<a th:href="${thHref}" target="_blank">th:href="${thHref}"</a>

<h2>th:each</h2>
<ul>
    <li th:each="str, iterStat:${thEach}" th:text="${str}"></li>
</ul>

<h2>th:if</h2>
<div th:if="${false}">
    这是th:if的内容
</div>
<div th:if="${true}">
    这是th:if的内容
</div>
<div th:if="${2+1>2}">
    这是th:if的内容[th:if="${2+1>2}"]
</div>
<div>
    字段串判断：<span th:text="${msg=='22'?'是22':'不是22'}"></span><br/>
    字段串判断：<span th:text="${msg=='标准变量表达式'?'是22':'不是22'}"></span>
</div>
<!-- 如果添加为假，执行标签内的内容 -->
<div th:unless="${false}">
    th:unless="${false}"
</div>

<h2>动态显示脚本</h2>
<script th:if="${2+1>2}">
    console.log('-----');
</script>
<script th:inline="javascript" type="text/javascript" >
    const html = [[${html}]];
    console.log('html: ', html);
</script>
<h2>属性值</h2>
<div>
    ${msg}
</div>
attr: <div th:attr="title=${msg+'333'}">默认文本内容</div>
<img th:src="${thSrc}" th:attr="alt=${msg+'图片'},title=${msg+'title'}"/>
</body>
</html>
